/********************************
 * ETK - Easy ToolKit
 * Copyright (C) 2007-2008 Ekinoks (scv.ekinoks@gmail.com)
 * All rights reserved.
 *
 *    This file is part of ETK.
 *
 *    Foobar is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    Foobar is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with Foobar; if not, write to the Free Software
 *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 ***********************************************************************************/

#ifndef __ETK_BUTTON_H__
#define __ETK_BUTTON_H__

#include "../Widget.h"
#include "../../CallBack/CallBack.h"
#include "../../CallBack/CallBackI/CallBackT/CallBackT.h"

#include "../../Render/ToolKit/ToolKit.h"
#include "../../Render/Render.h"
#include "../../define.h"


#include <string>

namespace etk
{
    class WidgetContainer;
    class CallBack;
    class Event;

    class EventClicked : public Event
    {
        public :
            EventClicked(event_e event) : Event(event)
            {
            }

            void updateEvent(void* realEvent)
            {
            }
    };

    /// Modelise un bouton
    class Button : public Widget
    {

        public :
            template<class F>
            Button(WidgetContainer * container, const char * label, F f) : Widget( TOOL_KIT.button_new_with_label(label), container )
            {
                toClicked(f);
            }

            Button(WidgetContainer * container, const char * label) : Widget( TOOL_KIT.button_new_with_label(label), container )
            {

            }

            template<class F>
            CallBack* toClicked(F f)
            {
                return new CallBackT<Event>(this, EVENT_CLICKED, f);
            }

            virtual ~Button();
    };
}

#endif /* #ifndef __ETK_BUTTON_H__ */





